import request from '@/utils/request'

// 查询房源列表
export function listHouse(query) {
    return request({
        url: '/house/house/list',
        method: 'get',
        params: query
    })
}

// 查询房源详细
export function getHouse(id) {
    return request({
        url: '/house/house/' + id,
        method: 'get'
    })
}

// 新增房源
export function addHouse(data) {
    return request({
        url: '/house/house',
        method: 'post',
        data: data
    })
}

// 修改房源
export function updateHouse(data) {
    return request({
        url: '/house/house',
        method: 'put',
        data: data
    })
}

// 删除房源
export function delHouse(id) {
    return request({
        url: '/house/house/' + id,
        method: 'delete'
    })
}


export const getImagesApi = (id) => request.get(`/house/house/images/${id}`)

export const uploadImageApi = (id, urls) => request({
    url: `/house/house/add-images/${id}`,
    method: 'post',
    data: urls
})
